package pathways;

/**
 * Title:        Pathways
 * Description:  Pure Java version of the Pathways Project.
 * Copyright:    Copyright (c) 2002
 * Company:      Ants Technologies
 * @author Veejay Sani
 * @version 1.0
 */

import java.awt.Point;

public class CSubstrateAsEnzyme extends CEnzyme
{
  private CSubstrate sub;
  private CEnzyme enz;
  private int connectingFrom;
  
  public CSubstrateAsEnzyme(CSubstrate sub, CEnzyme enz, int connectFrom, Point fromPoint, int connectTo)
  {
    super("",0);
    
    this.p1 = fromPoint;
    this.connectingTo = connectTo;
    this.connectingFrom = connectFrom;
    
    setSubstrate(sub);
    setEnzyme(enz);
    
  }
  
  public int getConnectingFrom()
  {
    return connectingFrom;  
  }
  
  public CSubstrate getSubstrate()
  {
    return sub; 
  }
  
  public CEnzyme getEnzyme()
  {
    return enz; 
  }
  
  public void setSubstrate(CSubstrate s)
  {
    sub = s; 
  }
  
  public void setEnzyme(CEnzyme e)
  {
    enz = e;
    calcPoint2(); 
  }
  
  public void calcPoint2()
  {
    Point lp1 = enz.getPoint1();
    Point lp2 = enz.getPoint2();
    int dx = 0;
    int dy = 0;
    
    //if (connectingTo == 0 && connectingTo == 2)
    //{
      dx = (lp2.x - lp1.x)/2;
      dy = (lp2.y - lp1.y)/2;
    //}
    //else if (connectingTo == 1 && connectingTo == 3)
    //{
    //  dx = 0;
    //  dy = (lp2.y - lp1.y)/2;
    //}
    
    p2 = new Point(lp1.x + dx, lp1.y + dy); 
  }
}